import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Main {
    public static void main(String[] args) {
          ApplicationContext ctx=new ClassPathXmlApplicationContext("application.xml");
//        通过id+类型
//        Student zhangsan1 = ctx.getBean("zhangsan", Student.class);
//        通过id
//        Student zhangsan2 = (Student) ctx.getBean("zhangsan");
//        通过类型
//        Student zhangsan3 =  ctx.getBean(Student.class);
//        System.out.println(zhangsan3);
//        System.out.println(zhangsan1);
//        System.out.println(zhangsan2);
//        通过alias配置别名
//        System.out.println("-------------------------------------");
//        Student zhangsan4 = ctx.getBean("xiaozhang", Student.class);
//        System.out.println(zhangsan4);
        Student bean = ctx.getBean("student",Student.class);
        System.out.println(bean);

    }
}
